<template>
  <div>
    <van-nav-bar title="资讯列表" left-text="返回" left-arrow @click-left="back" />

    <div class="news" v-for="item in list" :key="item.id">
        <div class="news-title">{{item.title}}</div>
        <img :src="'http://124.93.196.45:10001'+item.cover" alt="">
        <div class="news-content" v-html="item.content"></div>
        
        <div class="news-num">浏览次数：{{item.readNum}}
        <span>收藏次数：{{item.likeNum}}</span>
        </div>
        <div class="news-time">上传时间：{{item.createTime}}</div>
        
        
        
    </div>
  </div>
</template>

<script>
import {infolist} from "./Service"
import mixin from  "@/mixin/flag";
export default {
    mixins:[mixin],
    data(){
        return{
            list:[]
        }
    },
    methods:{
        back(){
            this.$router.go(-1);
        }
    },
    async created(){
        let res = await infolist({
            type:this.$route.params.id
        });
        console.log(res);
        this.list=res.data.rows
    }
}

</script>

<style lang="scss" scoped>
.news{
    padding: 0 15px;
    font-size: 16px;
    margin-top:15px;
    border-bottom:1px solid #666 ;
    .news-title{
        font-size: 18px;
        font-weight: bold;
        margin-bottom: 15px;
    }
    img{
        width: 100%;
        height: 150px;
    }
    .news-content{
        
        margin-bottom: 15px;
        
        ::v-deep p{
            margin:5px 0 ;
            text-indent: 1em;
            font-size: 14px;
        }
    }
    .news-num{
        font-size: 14px;
        margin-bottom: 10px;
        span{
            margin-left: 100px;
        }
    }
    .news-time{
        font-size: 14px;
        margin-bottom: 20px;
    }
}

</style>